<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>任务详情</title>
    <meta name=viewport content="width=device-width,initial-scale=1">
    <link rel="stylesheet" href="${ctx}/css/font/iconfont.css">
    <link rel="stylesheet" type="text/css" href="${ctx}/css/style.css">
    <script src="${ctx}/js/jquery.min.js"></script>
    <script type="text/javascript">
        function doGrab() {
            var url = "${ctx}/temp/worker-snatch.do";
            var Id = $("#Id").val();
            var workerId = $("#workerId").val();
            var workerName = $("#workerName").val();
            var workerPhone = $("#workerPhone").val();
            var param = {
                orderId: Id,
                workerId:workerId,
                workerName:workerName,
                workerPhone:workerPhone
            };
            $.post(url, param, function (res) {
                if (res.success == "1") {
                    alert("抢单成功");
                    WeixinJSBridge.call('closeWindow');
                } else {
                    alert("抢单失败");
                    WeixinJSBridge.call('closeWindow');
                }
            }, "json")
        }

    </script>
</head>
<body>
<input type="hidden" id="Id" value="${order.orderNo}">
<input type="hidden" id="workerId" value="${order.workerId}">
<input type="hidden" id="workerName" value="${order.workerName}">
<input type="hidden" id="workerPhone" value="${order.workerPhone}">

<div class="container">
    <c:if test="${success eq '1'}">
        <div class="gouda_cells">
            <div class="gouda_cell gouda_cell_warn">
                <div class="gouda_cell_hd"><label class="gouda_label">任务编号</label></div>
                <div class=" gouda_cell_primary">
                        ${order.orderNo}
                </div>
            </div>
            <div class="gouda_cell gouda_cell_warn">
                <div class="gouda_cell_hd"><label class="gouda_label">派单人</label></div>
                <div class=" gouda_cell_primary">
                        ${order.ownerName}
                </div>
            </div>
            <div class="gouda_cell gouda_cell_warn">
                <div class="gouda_cell_hd"><label class="gouda_label">联系电话</label></div>
                <div class=" gouda_cell_primary">
                        ${order.ownerPhone}
                </div>
            </div>
            <div class="gouda_cell gouda_cell_warn">
                <div class="gouda_cell_hd"><label class="gouda_label">派单时间</label></div>
                <div class=" gouda_cell_primary">
                        ${order.createDate}
                </div>
            </div>
            <div class="gouda_cell gouda_cell_warn">
                <div class="gouda_cell_hd"><label class="gouda_label">内容</label></div>
                <div class=" gouda_cell_primary">
                        ${order.ownerMessage}
                </div>
            </div>
            <div class="gouda_cell gouda_cell_warn">
                <div class="gouda_cell_hd"><label class="gouda_label">服务开始时间</label></div>
                <div class=" gouda_cell_primary">
                        ${order.serverStartTime}
                </div>
            </div>
            <div class="gouda_cell gouda_cell_warn">
                <div class="gouda_cell_hd"><label class="gouda_label">酬劳费</label></div>
                <div class=" gouda_cell_primary">
                    ¥ ${order.serverReword}
                </div>
            </div>
        </div>
        <div class="gouda_btn_area btn-box">
            <!-- <a class="gouda_btn gouda_btn_def" onclick="doGrab();">抢单</a> -->
            <a class="gouda_btn gouda_btn_orange" onclick="doGrab();">抢单</a>
        </div>
    </c:if>
    <c:if test="${success eq '0'}">
        <div class="gouda_cells">
            <div class="gouda_cell gouda_cell_warn">
                <div class="gouda_cell_hd"><label class="gouda_label">任务编号</label></div>
                <div class=" gouda_cell_primary">
                        ${order.orderNo}
                </div>
            </div>
            <div class="gouda_cell gouda_cell_warn">
                <div class="gouda_cell_hd"><label class="gouda_label">派单人</label></div>
                <div class=" gouda_cell_primary">
                        ${order.ownerName}
                </div>
            </div>
            <div class="gouda_cell gouda_cell_warn">
                <div class="gouda_cell_hd"><label class="gouda_label">联系电话</label></div>
                <div class=" gouda_cell_primary">
                        ${order.ownerPhone}
                </div>
            </div>
            <div class="gouda_cell gouda_cell_warn">
                <div class="gouda_cell_hd"><label class="gouda_label">派单时间</label></div>
                <div class=" gouda_cell_primary">
                        ${order.createDate}
                </div>
            </div>
            <div class="gouda_cell gouda_cell_warn">
                <div class="gouda_cell_hd"><label class="gouda_label">内容</label></div>
                <div class=" gouda_cell_primary">
                        ${order.ownerMessage}
                </div>
            </div>
            <div class="gouda_cell gouda_cell_warn">
                <div class="gouda_cell_hd"><label class="gouda_label">服务开始时间</label></div>
                <div class=" gouda_cell_primary">
                        ${order.serverStartTime}
                </div>
            </div>
            <div class="gouda_cell gouda_cell_warn">
                <div class="gouda_cell_hd"><label class="gouda_label">酬劳费</label></div>
                <div class=" gouda_cell_primary">
                    ¥ ${order.serverReword}
                </div>
            </div>
        </div>
        <div class="gouda_btn_area btn-box">
             <a class="gouda_btn gouda_btn_def" onclick="doGrab();">单子已被抢</a>
        </div>
    </c:if>
    <c:if test="${success eq '2'}">
        <div class="error-box">
            <div class="img"><img src="${ctx}/images/error-img.png" alt=""></div>
            <p>亲，下手晚了吧。。。<br>单子已经被抢完了哦，<br>下次再来吧~~~</p>
        </div>
    </c:if>

</div>
</body>
</html>